package com.molan.molan_music;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Slf4j
@SpringBootApplication
@MapperScan(value = {"com.molan.molan_music.dao"})
public class MolanMusicApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext run = SpringApplication.run(MolanMusicApplication.class, args);
        ConfigurableEnvironment environment = run.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = environment.getProperty("server.port");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application is Running! Access URL:\n\t " +
                "swagger文档:\thttp://"+ip+":"+port+"/swagger-ui/index.html\n" +
                "\n-----------------------------------------------------------\n\t");
    }

}
